//
//  MSettingsLayer.m
//  Coffee
//
//  Created by sabhanayagam b on 4/27/11.
//  Copyright 2011 Cognizant. All rights reserved.
//

#import "MSettingsLayer.h"
#import "MenuItems.h"

@implementation MSettingsLayer
// on "init" you need to initialize your instance
-(id) init
{
	// always call "super" init
	// Apple recommends to re-assign "self" with the "super" return value
	if( (self=[super init] )) {
		
		// ask director the the window size
		CGSize size = [[CCDirector sharedDirector] winSize];
		
		//Title
		CCLabelTTF *title = [CCLabelTTF labelWithString:@"Settings" fontName:@"Marker Felt" fontSize:32];
		[title setColor:ccBLACK];
		// position the label on the center of the screen
		title.position =  ccp( size.width * .5 , size.height - OFFSET  );
		// add the label as a child to this Layer
		[self addChild: title];
		
		//NSArray  * menuItemLabel = [NSArray arrayWithObjects:@"Play",@"Levels",@"Settings",@"About Us",nil];
		
		//Music
		CCLabelTTF *musicLabel = [CCLabelTTF labelWithString:@"Music : " fontName:@"Marker Felt" fontSize:24];
		CCMenuItemLabel *music = [CCMenuItemLabel itemWithLabel:musicLabel target:self selector:@selector(playHandler:)];
		
		
		[CCMenuItemFont setFontName: @"Marker Felt"];
		[CCMenuItemFont setFontSize:24];
		
		CCMenuItemToggle *musicOnOff = [CCMenuItemToggle itemWithTarget:self selector:@selector(playHandler:) items:
								   [CCMenuItemFont itemFromString: @"On"],
								   [CCMenuItemFont itemFromString: @"Off"],
								   nil];
		//Back Button
		
		[self addChild:[MenuItems backButtonRenderTo:self]];	
		
		//Main Container
		
		CCMenu *menu = [CCMenu menuWithItems: music , musicOnOff, nil];
		
		//[menu alignItemsInColumns:[NSNumber numberWithUnsignedInt:2],
		//[NSNumber numberWithUnsignedInt:2],nil];
		[menu alignItemsHorizontally];
		[menu setColor:ccBLACK];
		[self addChild: menu];
		
	
	}
	return self;
}
-(void) playHandler: (id) sender
{
}
-(void) itemClickHandler: (id) sender
{
	[(CCMultiplexLayer*)parent_ switchTo:0];

}
// on "dealloc" you need to release all your retained objects
- (void) dealloc
{
	// in case you have something to dealloc, do it in this method
	// in this particular example nothing needs to be released.
	// cocos2d will automatically release all the children (Label)
	
	// don't forget to call "super dealloc"
	[super dealloc];
}
@end
